package cn.te.helloo;

import com.sun.deploy.util.SyncFileAccess;
import org.omg.CORBA.portable.OutputStream;

import java.io.*;
import java.util.Scanner;

public class Test01 {
    public static void main(String[] args)  {
        String from = new Scanner(System.in).nextLine();
        String to = new Scanner(System.in).nextLine();
        copyof(from, to);
        System.out.println("文件复制成功");

    }

    public static void copyof(String from, String to)  {
        InputStream in = null;
        BufferedOutputStream out = null;
        try {
            in = new BufferedInputStream(new FileInputStream(from));
            out = new BufferedOutputStream(new FileOutputStream(to));
            int b = 0;
            byte[] buf = new byte[8124];
            while ((b = in.read(buf)) != -1) {
                out.write(buf);
            }
        }catch(Exception e){
            e.printStackTrace();

        }finally {
            try {
                in.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
            try {
                out.close();
            } catch (IOException e) {
                e.printStackTrace();
            }


        }

    }
}